<template>
<!-- 商品列表组件 -->
   <nuxt-link class="gi-link" to="/login">
    <div class="gi-wrap">
      <img class="gi-img"  :src="item.skuImage" />
      <img class="gi-tag-img" v-if="index === 0"  src="../assets/images/l-list-one.png" />
      <img class="gi-tag-img" v-else-if="index === 1" src="../assets/images/l-list-two.png" />
      <img class="gi-tag-img" v-else-if="index === 2" src="../assets/images/l-list-three.png" />
      <div class="gi-tag" v-else>{{index+1}}</div>
      <div class="gi-text">
        <p class="gi-text-price"><span>¥</span>{{item.price}}</p>
        <p class="gi-text-name" :title="item.skuName">{{item.skuName}}</p>
        <div class="gi-text-bottom">
          <div>浏览量：<span>{{item.viewNum}}</span></div>
          <div>销量：<span>{{item.salesNum}}</span></div>
        </div>
      </div>
    </div>
   </nuxt-link>
</template>
<script>
export default {
  props: {
    index: {
      type: Number,
      default: 0
    },
    item: {
      type: Object,
      default: () => {
        return {}
      }
    }
  }
}
</script>

<style scoped>
  .gi-link {
    width: 280px;
    height: 410px;
    box-sizing: border-box;
    display: block;
    background: #fff;
  }
  .gi-wrap {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
  }
  .gi-img {
    width: 280px;
    height: 281px;
  }
  .gi-tag-img {
    position: absolute;
    top: 18px;
    z-index: 3;
    left: -7px;
    width: 121px;
    height: 29px;
  }
  .gi-tag {
    background: url('../assets/images/l-list-other.png') no-repeat;
    width: 37px;
    height: 29px;
    background-size: 100% 100%;
    position: absolute;
    top: 18px;
    z-index: 3;
    left: -7px;
    text-align: center;
    line-height: 25px;
    color: #fff;
    font-size: 16px;
  }
  .gi-text {
    border: 1px solid #e1e1e1;
    border-top: none;
    flex: 1;
    padding: 15px 13px;
  }
  .gi-text-price {
   color: #de1e1e;
   font-size: 18px;
  }
  .gi-text-price span {
    font-size: 14px;
  }
  .gi-text-name {
    font-size: 16px;
    color: #000;
    line-height: 1.2;
    margin-top: 5px;
    text-overflow: ellipsis;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    text-align: justify;
  }
  .gi-text-bottom {
    display: flex;
    margin-top: 15px;
    align-items: center;
    justify-content: space-between;
    font-size: 16px;
    color: #666;
  }
  .gi-text-bottom span {
    color: #ff6600;
  }
</style>
